﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using TestEnvirementCL.POCO;
using TestEnvirementCL.Concrete;
using System.Reflection;
namespace TestEnvirementMVC.Controllers
{
    public class MeetingController : Controller
    {
      private EFDbContext db = new EFDbContext();

      //
      // GET: /Meeting/

      public ActionResult Index()
      {
        var meetings = db.Meetings.ToList<Meeting>();
        var teams = db.Teams.ToList<Team>();

        MyChart test = new MyChart();
        String startupPath = Assembly.GetAssembly(typeof(MyChart)).Location;

        test.initialiseDataSerieArray(meetings.Count);
        for (int i = 0; i < meetings.Count; i++)
        {
          test.countPerName[i] = test.nieuweRij(meetings[i].Name, meetings[i].Teams.Count);
        }

        ViewBag.ListMeeting = test.countPerName;
        ViewBag.ListTeams = teams;
        ViewBag.ListMeetings = meetings;
        ViewBag.Message = "Google Charts Graphs";

        return View();
      }


    }
}
